package com.example.oct.controller;

import com.example.framework.common.pojo.R;
import com.example.framework.security.core.dto.JwtTokenRespDto;
import com.example.oct.feign.UserFeign;
import com.example.oct.feign.dto.PwdLoginReqVO;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import jakarta.annotation.security.PermitAll;
import jakarta.validation.Valid;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@Tag(name = "用户接口")
@RestController
public class UserController {

    @Resource
    private UserFeign userFeign;

    @PermitAll
    @Operation(summary = "通过用户名密码登录")
    @PostMapping("/login/byPassword")
    public R<JwtTokenRespDto> loginByPassword(@Valid @RequestBody PwdLoginReqVO reqDto) {
        return userFeign.loginByPassword(reqDto);
    }
}
